
<ul class="pagination pagination-sm no-margin pull-right" style="padding-top: 10px">
    <a class="first">首页</a>
    <a class="pre">上一页</a>
    <a class="next">下一页</a>
    <a class="last">尾页</a>
    <a class="rowCount">总记录数[0]</a>
    <a class="pageCount">总页数[0]</a>
    <a class="pageCurrent">当前页[1]</a>
</ul>

<script type="text/javascript">

    function doSetPagination(pageObject){
        $(".rowCount").html(`总记录数(${pageObject.rowCount})`);
        $(".pageCount").html(`总页数(${pageObject.pageCount})`);
        $(".pageCurrent").html(`当前页(${pageObject.pageCurrent})`);
        //存储当前页码值和总页数
        $("#pageId").data("pageCurrent",pageObject.pageCurrent);
        $("#pageId").data("pageCount",pageObject.pageCount);
    }
    $(function (){
        $("#pageId").on("click",".first,.pre,.next,.last",doJumpToPage)
    })
    function doJumpToPage(){
        let pageCurrent=$("#pageId").data("pageCurrent");
        let pageCount=$("#pageId").data("pageCount");
        let cls=$(this).prop("class");
        if (cls=="first"){
            pageCurrent=1;
        }else if(cls=="pre"&&pageCurrent>1){
            pageCurrent--;
        }else if(cls=="next"&&pageCurrent<pageCount){
            pageCurrent++;
        }else if(cls=="last"){
            pageCurrent=pageCount;
        }else {
            return;
        }
        //重新存储新的页码值
        $("#pageId").data("pageCurrent",pageCurrent);
        //调用列表中的doGetObjects方法，并在方法内部基于新的页码值重新执行查询
        doGetObject();
    }

</script>








